home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 May / Macworld (1999-05).dmg / Shareware World / Utilities / Diagnostic / Trash•Desktop 1.2.1 (FAT) / AppleScript Examples / Trash All & Restart.as < prev   
Text File  |  1999-01-29  |  945b  |  40 lines

  1. property TrashDesktopFullPath : "000000000000000000000000000"
  2.  
  3.  
  4.  
  5. on run
  6.     --
  7.     -- Checks the TrashDesktopFullPath and asks for a valid path if an error occurs
  8.     --
  9.     try
  10.         get info for file TrashDesktopFullPath
  11.     on error
  12.         set TrashDesktopFullPath to (choose file with prompt ¬
  13.             "Choose Trash•Desktop program:" of type {"APPL"}) as string
  14.     end try
  15.     
  16.     --
  17.     -- Make a volume's list of alias
  18.     --
  19.     set allVolumeList to {}
  20.     repeat with volumeName in list disks
  21.         set allVolumeList to allVolumeList & (volumeName & ":" as alias)
  22.     end repeat
  23.     
  24.     if TrashDesktopFullPath is not "" then
  25.         try
  26.             --set TrashDesktop to the name of (info for file TrashDesktopFullPath)
  27.             
  28.             --
  29.             -- Launch Trash•Desktop with all mounted volumes and then it quits automatically
  30.             --
  31.             launch application TrashDesktopFullPath
  32.             tell application TrashDesktopFullPath to open allVolumeList
  33.             
  34.             tell application "Finder" to restart
  35.             
  36.         on error
  37.         end try
  38.     end if
  39. end run
  40.